<?php


function unsCalendar_deleteBuilding($id) {
    
    global $babDB;
    
    $classroomsList = unsCalendar_getClassroomForBuilding($id);
    $classroomsListLength = count($classroomsList);
    
    static $k = 0;
    while ($k < $classroomsListLength) {
        unsCalendar_deleteClassroom($classroomsList[$k]['id']);
        $k++;
    }
    
    $babDB->db_query("delete from".UNSCALENDAR_BUILDINGS_TABLE_NAME." where id=".$id);
}


function unsCalendar_getAllBuilding() {

    global $babDB;


    $res = $babDB->db_query("select id, building_name as name from " . UNSCALENDAR_BUILDINGS_TABLE_NAME);

    $buildings = array();
    $i = 0;
    while ($arr = $babDB->db_fetch_array($res)) {
        $buildings[$i] = $arr;
        $i++;
    }
    return $buildings;
}

?>
